package com.captjack.micro.task;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author Administrator
 */
@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan("com.captjack.micro.task")
public class ElasticJobApplication {

    /**
     * 当前spring应用的上下文
     */
    private static ConfigurableApplicationContext configurableApplicationContext;

    /**
     * @param args 参数
     */
    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(ElasticJobApplication.class);
        // 启动，并且获取上下文
        configurableApplicationContext = application.run(args);
    }

    public static ConfigurableApplicationContext getConfigurableApplicationContext() {
        return configurableApplicationContext;
    }

}
